package com.mercury.share.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mercury.share.entity.ShareComments;
import com.mercury.share.entity.vo.CommentInfoVo;
import com.mercury.share.mapper.ShareCommentsMapper;
import com.mercury.share.service.ShareCommentsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tong
 * @since 2021-11-22
 */
@Service
public class ShareCommentsServiceImpl extends ServiceImpl<ShareCommentsMapper, ShareComments> implements ShareCommentsService {

    @Override
    public int getCount(int id) {
        QueryWrapper<ShareComments> wrapper = new QueryWrapper<>();
        wrapper.eq("share_id", id);
        return baseMapper.selectCount(wrapper);
    }

    @Override
    public List<CommentInfoVo> getCommentList(int id) {
        List<CommentInfoVo> commentList = baseMapper.getCommentList(id);
        return commentList;
    }
}